import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'
import NoteList from '../views/NoteList.vue'
import NoteEdit from '../views/NoteEdit.vue'

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'Home',
      component: Home
    },
    {
      path: '/notes',
      name: 'NoteList',
      component: NoteList
    },
    {
      path: '/notes/edit/:id?',
      name: 'NoteEdit',
      component: NoteEdit
    },
    {
      path: '/:pathMatch(.*)*',
      redirect: '/home'
    }
  ]
})

export default router
